package com.yxdj.service.api.factory;

import com.yxdj.common.core.domain.R;
import com.yxdj.service.api.RemoteSubCategoryService;
import com.yxdj.service.api.domain.SubCategory;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

/**
 * @author 韩总
 */
public class RemoteSubCategoryFallbackFactory implements FallbackFactory<RemoteSubCategoryService> {
    @Override
    public RemoteSubCategoryService create(Throwable cause) {
        return new RemoteSubCategoryService() {
            @Override
            public R<List<SubCategory>> getSubCategoryList(Integer limit, String source) {
                return R.fail("远程调用服务微服务获取前三个子分类失败："+cause.getMessage());
            }
        };
    }
}
